<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ page import="shmged.com.shlcm.utils.*"%>
<%@ page import="wt.inf.container.WTContainer"%>
<%@ page import="wt.inf.container.WTContainerRef"%>
<%@ page import="wt.folder.Folder" %>
<%@ page import="wt.folder.FolderHelper" %>
<%@page import="wt.httpgw.URLFactory"%>


<%@page import="shmged.com.shlcm.workflow.CmWorkFlowHelper"%></head>
<%
String baseUrl = new URLFactory().getBaseHREF();
String contName = CmSettings.getSection("DefaultLocation").get("SHMGEDContainer");
CmWorkFlowHelper.print("");	   
	   


   

%>
<div>
  <h2>待办事宜</h2>
</div>
<table id="companyTaskList_todo"></table>
<div>
  <h2>已办事宜</h2>
</div>
<table id="companyTaskList_down"></table>
<script>
function completeWorkInNewWindoow(oid){
	window.open(pageBaseUrl+"shmged/jsp/com/shlcm/workflow/setparticipant/tpTaskService.jsp?oid="+oid);
}
workItemsRunningTable();
workItemsCloseTable();
function workItemsRunningTable(){
	var url='<%=baseUrl%>shmged/jsp/com/shlcm/workflow/jspGetMyWorkItem.jsp';
	  $('#companyTaskList_todo').datagrid({
		  width:740,
		  height:200,   
	      url:url,
	      queryParams:{workState:"正在运行"},
	      nowrap:false,
	      loadMsg:'正在加载数据，请稍等。。。',
		  fitColumns: true,
	      columns:[[   
			  {field:'id',title:'id',width:20,hidden:true},
			  {field:'itemImg',title:'',width:15,hidden:true},  
			  {field:'waName',title:'名称',width:50,  //添加超级链 
                  formatter:function(value,rowData,rowIndex){
					if(rowData.number!=""){
              		 return "<a href='javaScript:void(0)' onclick=\"javaScript:completeWorkInNewWindoow('"+rowData.id+"')\">"+rowData.waName+"</a>";  
	          		}
			  }
		          }, 
			  {field:'docImg',title:'',width:15,hidden:true}, 
			  {field:'doc',title:'主题',width:200,
				  formatter:function(value,rowData,rowIndex){
					if(rowData.number!=""){
            		 return "<a href='javaScript:void(0)' onclick=\"javaScript:subWorkItem('"+rowData.oid+"')\">"+rowData.doc+"</a>";  
	          		}
			  }
		          },  
			  {field:'state',title:'状态',width:50}, 
			  {field:'modfTime',title:'最后更新时间',width:120}
	      ]] 
	    }); 
}

function workItemsCloseTable(){
	var url='<%=baseUrl%>shmged/jsp/com/shlcm/workflow/jspGetMyWorkItem.jsp';
	  $('#companyTaskList_down').datagrid({ 
		  width:740,
		  height:200,  
	      url:url,
	      queryParams:{workState:"已执行"},
	      nowrap:false,
	      loadMsg:'正在加载数据，请稍等。。。',
		  fitColumns: true,
	      columns:[[   
			  {field:'id',title:'id',width:20,hidden:true},
			  {field:'itemImg',title:'',width:15,hidden:true},  
			  {field:'waName',title:'名称',width:50,  //添加超级链 
                  formatter:function(value,rowData,rowIndex){
					if(rowData.number!=""){
              		 return "<a href='javaScript:void(0)' onclick=\"javaScript:completeWorkInNewWindoow('"+rowData.id+"')\">"+rowData.waName+"</a>";  
	          		}
			  }
		          }, 
			  {field:'docImg',title:'',width:15,hidden:true}, 
			  {field:'doc',title:'主题',width:200,
				  formatter:function(value,rowData,rowIndex){
					if(rowData.number!=""){
            		 return "<a href='javaScript:void(0)' onclick=\"javaScript:subWorkItem('"+rowData.oid+"')\">"+rowData.doc+"</a>";  
	          		}
			  }
		          },  
			  {field:'state',title:'状态',width:50}, 
			  {field:'zk',title:'状况',width:50}, 
			  {field:'modfTime',title:'最后更新时间',width:120}
	      ]] 
	    }); 
}


function commitWorkItem(id)
{
	addworkItemTab("","",id);
	
}

function subWorkItem(id)
{
	addworkItemPBOTab("","",id);
	
}

function addworkItemTab(tabObj,tabId,oid){
	var defaultTabId = "cmTabs";
	if(tabId){
		defaultTabId = tabId;
	}
	var tabDefault = {
		href:pageBaseUrl+"shmged/jsp/com/shlcm/reimbursement/browseShowReimbursement.jsp?oid="+oid,
		title:"查看信息 ",
		selected: true,
		closable:true
	};
	var options ;
	if(tabObj){
	    var empty = {};
		options = $.extend(empty,tabDefault,tabObj);
	}else{
		options = tabDefault;
	}
	if($('#'+defaultTabId).tabs("exists",options.title)){
		$('#'+defaultTabId).tabs('select',options.title);
	}else{
	    $('#'+defaultTabId).tabs('add',options);
	}
}



function addworkItemPBOTab(tabObj,tabId,oid){
	var defaultTabId = "cmTabs";
	if(tabId){
		defaultTabId = tabId;
	}
	var tabDefault = {
		href:pageBaseUrl+"shmged/jsp/com/shlcm/reimbursement/browseShowReimbursement.jsp?oid="+oid,
		title:"查看信息",
		selected: true,
		closable:true
	};
	var options ;
	if(tabObj){
	    var empty = {};
		options = $.extend(empty,tabDefault,tabObj);
	}else{
		options = tabDefault;
	}
	if($('#'+defaultTabId).tabs("exists",options.title)){
		$('#'+defaultTabId).tabs('select',options.title);
	}else{
	    $('#'+defaultTabId).tabs('add',options);
	}
}

</script>